package com.tutorialspoint;

import com.dao.StudentDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class MainApp {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
        StudentDao bean = (StudentDao)context.getBean("studentJDBCTemplate");
        bean.create("李相赫",3,4,7);
        bean.create("faker",1,1,1);
        bean.create("hide on bush",2,2,2);
        List<StudentMarks> studentMarks = bean.listStudents();
        studentMarks.forEach(studentMarks1 -> {
            System.out.println("ID"+studentMarks1.getId());
            System.out.println("Name"+studentMarks1.getName());
            System.out.println("Year"+studentMarks1.getYear());
            System.out.println("Age"+studentMarks1.getAge());
        });
    }
}
